/**
 * Copyright:  Copyright (c) 2013
 *
 * @FileName		: ResultForestLandAction.java
 * @PageName		: 
 * @Date			: 오후 2:41:45
 * @LastModifier	: 최경민
 * @LastModifyDate	: 
 * @LastModifier	: 
 * Change history	:
 */
package com.pulp.sales.action;

import java.util.List;

import javax.servlet.ServletContext;
import javax.servlet.http.HttpServletRequest;

import org.apache.log4j.Logger;
import org.apache.struts2.ServletActionContext;
import org.springframework.web.context.WebApplicationContext;
import org.springframework.web.context.support.WebApplicationContextUtils;

import com.opensymphony.xwork2.ActionSupport;
import com.pulp.sales.model.ResultForestLandInfo;
import com.pulp.sales.service.ResultForestLandService;

/**
 * @author 최경민
 * 
 */
public class ResultForestLandAction extends ActionSupport {
	private static final long serialVersionUID = 5086193621283386681L;
	private String REQUEST_RESULT = "ok";
	static Logger logger = Logger.getLogger(ResultForestLandAction.class);

	private String errorCode = "";
	private String page;

	private List<ResultForestLandInfo> myList = null;

	/**
	 * @return the rEQUEST_RESULT
	 */
	public String getREQUEST_RESULT() {
		return REQUEST_RESULT;
	}

	/**
	 * @param rEQUEST_RESULT the rEQUEST_RESULT to set
	 */
	public void setREQUEST_RESULT(String rEQUEST_RESULT) {
		REQUEST_RESULT = rEQUEST_RESULT;
	}

	/**
	 * @return the logger
	 */
	public static Logger getLogger() {
		return logger;
	}

	/**
	 * @param logger the logger to set
	 */
	public static void setLogger(Logger logger) {
		ResultForestLandAction.logger = logger;
	}

	/**
	 * @return the errorCode
	 */
	public String getErrorCode() {
		return errorCode;
	}

	/**
	 * @param errorCode the errorCode to set
	 */
	public void setErrorCode(String errorCode) {
		this.errorCode = errorCode;
	}

	/**
	 * @return the page
	 */
	public String getPage() {
		return page;
	}

	/**
	 * @param page the page to set
	 */
	public void setPage(String page) {
		this.page = page;
	}

	/**
	 * @return the myList
	 */
	public List<ResultForestLandInfo> getMyList() {
		return myList;
	}

	/**
	 * @param myList the myList to set
	 */
	public void setMyList(List<ResultForestLandInfo> myList) {
		this.myList = myList;
	}

	public String execute() throws Exception {
		try {
			HttpServletRequest request = (HttpServletRequest) ServletActionContext.getRequest();

			ServletContext servletContext = ServletActionContext.getServletContext();
			WebApplicationContext wac = WebApplicationContextUtils.getWebApplicationContext(servletContext);
			ResultForestLandService rfService = (ResultForestLandService) wac.getBean("salesService");
			myList = (List<ResultForestLandInfo>) rfService.getResultForestColumnChartList();
		} catch (Exception e) {
			REQUEST_RESULT = "FAILED";
			e.printStackTrace();
		}
		return REQUEST_RESULT;
	}

}
